package file;

import java.io.File;
import java.io.FileFilter;
import java.util.Arrays;

public class ListFilesDemo2 {
    public static void main(String[] args) {
        File dir = new File(".");
        FileFilter filter = new FileFilter() {
            @Override
            public boolean accept(File file) {
                String name = file.getName();
                System.out.println("正在过滤的项目是："+name);
                    return name.startsWith(".");
            }
        };
        File[] subs = dir.listFiles(filter);
        String str = Arrays.toString(subs);
        System.out.println(str);
        System.out.println("当前目录下子项有:"+subs.length);
    }
}
